define(()=>{
    return function(userMsg, last_a) {
        'use strict';
        if(localStorage.getItem("isLogin") !== "YES"){
            location.href = "./login.html";
        }
        class Whethertologin{
            constructor(ops){
                this.userMsg = ops.userMsg
                this.last_a = ops.last_a
                this.addEvent();
                this.isLogin();
            }
            isLogin(){
                if(localStorage.getItem("isLogin") === "YES"){
                    this.userMsg.innerHTML = `&nbsp;${localStorage.getItem("username")} 新华伴您畅游书海。`;
                }else{
                    location.href = "./login.html"
                }
            }
            addEvent(){
                this.last_a.addEventListener("click",()=>{
                    localStorage.setItem("isLogin","");
                })
            }
        }
        new Whethertologin({
            last_a:last_a,
            userMsg:userMsg
        });
    }
    
});

